export default {
  data() {
    return {
      searchForm: {},
      pageName: 'xxx'
    }
  },

  

  created() {
    console.log('created');
    this.$store.dispatch(`${this.pageName}/search`, {
      searchForm: {},
      currentPage: 1,
      pageSize: 10
    })
  },

  methods: {
    onSubmit() {
      console.log('onSubmit');
      this.$store.dispatch(`${this.pageName}/search`, {
        searchForm: this.searchForm,
        currentPage: 1,
        pageSize: 10,
        check: true
      });
    },
    currentChange(currentPage) {
      console.log('currentChange');
      this.$store.dispatch(`${this.pageName}/search`, {
        searchForm: this.searchForm,
        currentPage: currentPage,
        pageSize: 10
      });
    },
    onAdd() {
      this.$store.dispatch(`${this.pageName}/edit`, {
        editType: 'add'
      });
    },
    handleEdit(index, row) {
      console.log(row);
      this.$store.dispatch(`${this.pageName}/edit`, {
        editType: 'edit',
        editRow: row
      });
    },
    handleDelete(index, row) {
      this.$store.dispatch(`${this.pageName}/delete`, row.id);
    }
  }
}